home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1998 #4
/
Amiga Plus CD - 1998 - No. 4.iso
/
pd
/
grafik
/
metaview
/
arexx-examples
/
finalwriter_import.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1998-02-10
|
2KB
|
102 lines
/* Graphics Imports with MetaView for FinalWriter*/
METAVIEW = 'MetaView:MetaView' /* Please complete the path */
OPTIONS RESULTS
SIGNAL ON FAILURE
SIGNAL ON SYNTAX
/*
** Looking for our start process
*/
APLPORT = ADDRESS()
if (LEFT(APLPORT, 6) ~= "FINALW") then do /* not started from Application */
say "Please start me from Application!"
EXIT
end
/*
** Create a new Metaview process:
** first look for the allready running processes
** then the new Port will be the next one
*/
do NUMBER = 0 to 20
if (SHOW(PORTS,"METAVIEW." || NUMBER) = 0) then
leave
end
/*
** Searching for MetaView: 1. our path above,
** 2. path in env:MetaView.path
** or 3. you must have a assign "MetaView:"
*/
if (EXISTS(METAVIEW)=0) then do
if OPEN("MVVAR","env:MetaView.path","Read") then do
METAVIEW = READLN("MVVAR")
end
if (EXISTS(METAVIEW)=0) then do
METAVIEW = "MetaView:MetaView"
end
end
/*
** Enable warnings for WaitForPort
*/
OPTIONS FAILAT 5
ADDRESS COMMAND
"run " || METAVIEW || " NODISPLAY"
MVPORT = "METAVIEW." || NUMBER
"WaitForPort " || MVPORT
/*
** Ignore the other errors
*/
OPTIONS FAILAT 21
/*
** Do all needed thinks with MetaView (LOAD,SAVE,QUIT...)
*/
ADDRESS VALUE MVPORT
REQUESTFILE ""
FILENAME = result
LOAD '"'FILENAME'"'
SAVE '"T:Test.eps"' AS EPS
QUIT
/*
** Import the temporary file in application
*/
ADDRESS VALUE APLPORT
InsertImage 'T:Test.eps'
ObjectIMG = Result
IF (ObjectIMG = 0) then exit_msg('"Error loading graphicfile"')
SetObjectTitle ObjectIMG '"'FILENAME'"' /* Remember objectfilename */
SetObjectParams ObjectIMG Linked No Display Full /* Save object with document */
Redraw
EXIT
FAILURE:
ADDRESS COMMAND
REQUESTCHOICE "Error" """Can't find" METAVIEW "!""" "OK"
EXIT
SYNTAX:
say "Error on line" SIGL ":" ERRORTEXT(RC) "!"
EXIT
exit_msg: procedure
DO
parse arg message
if message = '' then exit
ShowMessage 1 0 message '"" "" "OK" "" ""'
exit
END